package cn.wetcland.es.utils;

import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;

/**
 * @author Najoker
 */
public class UrlMatcher {

    private UrlMatcher() {
    }

    /**
     * 匹配资料
     *
     * @param patternPath 模糊匹配表达式
     * @param requestPath 待匹配的url
     * @return 是否匹配
     */
    public static boolean match(String patternPath, String requestPath) {
        if (patternPath == null || patternPath.length() == 0) {
            return false;
        }
        PathMatcher matcher = new AntPathMatcher();
        return matcher.match(patternPath, requestPath);
    }

}
